<?php

namespace App\Models;



class MallOrderComment extends Base
{
    const TYPE_SERVICE = 1;

    protected $casts = [
        'file' => 'array',
    ];

    protected $fillable = ['user_id', 'order_product_id', 'message', 'star', 'reply_message', 'is_anonymous', 'file', 'product_id', 'order_id'];

    public function user() {
        return $this->belongsTo(User::class, 'user_id');
    }


    public function setFileAttribute($value) {
        return $this->attributes['file'] = json_encode_cn($value);
    }

    public function order_product() {
        return $this->belongsTo(MallOrderProduct::class, 'order_product_id');
    }



}
